package cn.edu.stu.syllabus.library.star;

import cn.edu.stu.syllabus.dao.BookEntryDao;
import cn.edu.stu.syllabus.repository.library.BookStarDataSource;
import cn.edu.stu.syllabus.repository.library.local.BookStarLocalDataSource;
import cn.edu.stu.syllabus.di.qualifier.Local;
import cn.edu.stu.syllabus.di.scope.FragmentScoped;
import cn.edu.stu.syllabus.utils.GreenDaoUtils;
import dagger.Module;
import dagger.Provides;

/**
 * Created by daidaijie on 2017/4/1.
 */

@Module
public class BookStarPresenterModule {

    private final BookStarContract.View mView;

    public BookStarPresenterModule(BookStarContract.View view) {
        mView = view;
    }

    @Provides
    @FragmentScoped
    public BookStarContract.View provideView() {
        return mView;
    }

    @FragmentScoped
    @Provides
    BookEntryDao provideBookEntryDao() {
        return GreenDaoUtils.getInstance().getSession().getBookEntryDao();
    }

    @FragmentScoped
    @Provides
    @Local
    BookStarDataSource provideBookLocalDataSource(BookEntryDao bookEntryDao) {
        return new BookStarLocalDataSource(bookEntryDao);
    }
}
